<div class="row" ng-controller="messageList">
	<% include public/modal %>
    <div class="col-xs-12">
        <div class="box">
            <div class="box-body table-responsive no-padding" >
                <table class="table table-hover">
                    <tr>
                        <th>选择</th>
                        <th>文章标题</th>
                        <th>留言内容</th>
                        <th>留言者</th>
                        <th>关联ID(回复)</th>
                        <th>时间</th>
                        <th>管理</th>
                    </tr>

                    <tr ng-repeat="msgs in data">
                        <td><input type="checkbox" class="mini"/></td>
                        <td class="  sorting_1"><a href="/details/{{msgs.contentId}}.html" target="_blank">{{msgs.contentTitle | limitTo : 20}}</a></td>
                        <td class=" ">{{msgs.content | limitTo : 50}}</td>
                        <td class=" ">{{msgs.uName}}</td>
                        <td class=" ">{{msgs.relationUid}}</td>
                        <td class=" ">{{msgs.date | date : "yyyy-MM-dd HH:mm:ss"}}</td>
                        <td class=" ">
                            <button class="btn btn-primary btn-xs" data-whatever="{{msgs.content}}" data-toggle="modal" data-target="#getMsgDetails"><span class="fa fa-fw fa-comments-o" aria-hidden="true"></span>详情</button>
                            <button class="btn btn-default btn-xs" ng-click="delMsgsItem(msgs._id)"><span class="fa fa-fw fa-trash-o" aria-hidden="true"></span>删除</button>
                        </td>
                    </tr>

                </table>

            </div><!-- /.box-body -->
            <% include public/tableFooter %>
        </div><!-- /.box -->

    </div><!-- /.col -->
    

    <!--查看留言详情模态窗口-->
    <div class="modal fade" id="getMsgDetails">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">查看留言详情</h4>
                </div>
                <div class="modal-body">
                    <div class="" id="showMsgDetail" style="min-height: 60px;padding: 20px;">

                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

    </div><!-- /.row -->

</div>


<script>
    /*targetID:全局对应指定记录的标记，在修改和删除时使用*/

            doraApp.controller("messageList",function($scope,$http){
//                初始化名称和权限
                $scope.formData = {};
                //获取留言列表
                initPagination($scope,$http,"<%=bigCategory%>","<%=searchKey%>");
                //删除留言
                $scope.delMsgsItem = function(id){
                    initCheckIfDo($scope,id,'您确认要删除该条留言吗？',function(currentID){
                        angularHttpGet($http,"/admin/manage/<%=bigCategory%>/del?uid="+currentID,function(){
                            initPagination($scope,$http,"<%=bigCategory%>","<%=searchKey%>");
                        });
                    });
                };

//                查看留言详情
                $('#getMsgDetails').on('show.bs.modal', function (event) {
                    var obj = $(event.relatedTarget);
                    var msgDetails = obj.data('whatever');

                    $('#showMsgDetail').html(msgDetails);

                }).on('hidden.bs.modal', function (e) {
                    // 清空数据
                    $('#showMsgDetail').html("");
                });

            });

</script>